<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>单个课程信息</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
</head>
<body>
<h2 align="center">单个课程信息表</h2>
<form action="/admin/updateCourse.do" method="post">
    <table style="border: 1px;margin: 0 auto;background: snow" width="50%" cellpadding="5" cellspacing="0" >
        <tr>
            <input type="text" hidden name="id">
        <tr>
            <td>课程ID</td>
            <td><input type="text"  name="courseId" style="width: 95%"></td>
        </tr>
        <td style="background: salmon">课程名称</td>
        <td><input type="text" name="courseName"  style="width:95%" ></td>
        </tr>
        <tr>
            <td>老师工号</td>
            <td><input type="text" name="tnumber" style="width:95%"></td>
        </tr>
        <tr>
            <td>课程类型</td>
            <td><input type="text" name="courseType" style="width:95%"></td>
        </tr>
        <tr>
            <td>班级人数</td>
            <td><input type="text" name="stusize" style="width:95%"></td>
        </tr>
        <tr>
            <td colspan="2" >
                <input type="submit" value="提交" class="ipt">
            </td>
            <td colspan="2" >
                <input href="listCourse.html" type="submit" value="退出" class="ipt">
            </td>
        </tr>
    </table>
</form>
</body>
<script>
    var id=location.href.split("?")[1]
    id=new URLSearchParams(id).get("id")
    loadData();
    function loadData(){
        $.post("/admin/queryCourseById.do?id="+id,function(res){
            console.log(res)
            if (res.code == 0) {
                $("input")[1].value=res.data.courseId
                $("input")[2].value=res.data.courseName
                $("input")[3].value=res.data.tnumber
                $("input")[4].value=res.data.courseType
                $("input")[5].value=res.data.stusize
                $("input")[0].value=id
            }
        })
    }
</script>
</html>